Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.Configuration
Imports System.Data
Imports System.Data.SqlClient

Public Partial Class TheatreStaff_SpecialTickets
	Inherits System.Web.UI.Page
	Protected Sub Page_Load(sender As Object, e As EventArgs)
		srcSpecial.SelectParameters("username").DefaultValue = Page.User.Identity.Name
		'srcgrdSchedule.SelectParameters["username"].DefaultValue = Page.User.Identity.Name;
		'grdSpecialTickets.Sort("MovieTitle", SortDirection.Ascending);
		Dim connectionString As String
		connectionString = WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

		Dim con As New SqlConnection(connectionString)
		Dim cmd As New SqlCommand("SELECT TheatreId from TheatreStaff WHERE TheatreStaffUsername=@username", con)

		cmd.Parameters.AddWithValue("@username", Page.User.Identity.Name)

		Using con
			con.Open()
			Dim TheatreID As Object = cmd.ExecuteScalar()
			If TheatreID IsNot Nothing Then
				lblId.Text = TheatreID.ToString()
			End If
		End Using
		Dim con1 As New SqlConnection(connectionString)
		Dim cmd1 As New SqlCommand("SELECT Theatrename from Theatre WHERE Theatreid=@theatreid", con1)

		cmd1.Parameters.AddWithValue("@theatreid", lblId.Text)


		Using con1
			con1.Open()
			Dim Theatrename As Object = cmd1.ExecuteScalar()

			If Theatrename IsNot Nothing Then

				Label4.Text = Theatrename.ToString()
			End If
		End Using

    End Sub
    Protected Sub OnItemUpdated_Click(ByVal sender As Object, ByVal e As EventArgs)




        'srcCinema.InsertParameters["TheatreId"].DefaultValue = lblId.Text;
        grdSpecialTickets.DataBind()
    End Sub
    Protected Sub function2(ByVal sender As Object, ByVal e As EventArgs)
        Dim tb3 As DropDownList = DirectCast(dtlSpecial.FindControl("ddltype"), DropDownList)
        srcSpecialSelect.UpdateParameters("sessiontype").DefaultValue = tb3.SelectedItem.Text
    End Sub

    Private Sub Page_Load()
        If Not Page.IsPostBack Then
            grdSpecialTickets.SelectedIndex = 0
        End If
    End Sub

    Protected Sub function1(ByVal sender As Object, ByVal e As EventArgs)

        Dim tb3 As DropDownList = DirectCast(dtlSpecial.FindControl("ddltype"), DropDownList)

    End Sub
End Class
